﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
using NetDon.Utilities;

namespace NetDon.OA.Portal.Components
{
    public partial class ProvinceCity : System.Web.UI.UserControl
    {
     
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.ddlProvince.SelectedValue != string.Empty)
            {
                this.ddlCity.LoadDepartments(this.ddlProvince.SelectedValue);
            }
            else
            {
                this.ddlCity.Items.Clear();

            }
        }
        public string ProvinceCode
        {
            get { return this.ddlProvince.SelectedValue; }
            set
            {
                this.ddlProvince.SelectedValue = value;
                if (this.ddlProvince.SelectedValue != string.Empty)
                {
                    this.ddlCity.LoadDepartments(this.ddlProvince.SelectedValue);
                  
                }
                else
                {
                    this.ddlCity.Items.Clear();

                }
            }
        }

        public bool EnableCompanyId
        {
            get { return ddlProvince.Enabled; }
            set
            {
                ddlProvince.Enabled = value;
            }
        }
        public bool EnableDepartmentId
        {
            get { return ddlCity.Enabled; }
            set { ddlCity.Enabled = value; }
        }
        public string CityCode
        {
            get { return this.ddlCity.SelectedValue; }
            set
            {
                this.ddlCity.SelectedValue = value;
            }
        }

        public DropDownList ProvinceDropDownList
        {
            get { return ddlProvince; }
        }

        public DropDownList CityDropDownList
        {
            get { return ddlCity; }
        }
    }
}